/**
 * @title THHUserModel.java 
 * @description 	测试用户模块数据库操作
 * @create 			2012-8-9 下午6:06:27 By xjiujiu
 * @package 		test.apps.admin.model
 * @copyright 		Copyright (c) 2011-2012 http://xyrj.hhtc.edu.cn.com. All right reserved
 * @version         $Id$
 * XYRJ-Java-Project
 */

package test.apps.admin.model;

import java.util.List;
import java.util.Map;

import system.pojo.HHUserPojo;

import apps.admin.model.HHUserModel;
import junit.framework.Assert;
import junit.framework.TestCase;

/** 
 * 测试用户模块数据库操作 
 * 
 * @description
 * 
 * @classname 	THHUserModel 
 * @author 		xjiujiu<xjiujiu@foxmail.com>
 * @date 		2012-8-9 下午6:06:27 
 * @version 	1.0
 */
public class THHUserModel extends TestCase
{

	/**
	 * 测试得到用户列表
	 *  
	 * @description
	 * 
	 * @title  testGetList
	 * @return void
	 */
    @SuppressWarnings("rawtypes")
    public void testGetList()
	{
		int page 	= 0;
		int perpage = 10;
		HHUserModel user 	= new HHUserModel(new HHUserPojo());
		List<Map> userList 		= user.getList(page, perpage);
		for(int i = 0; i < userList.size(); i ++) {
			Map record 		= (Map)userList.get(i);
			System.out.println(record.get("user_name"));
		}
		Assert.assertEquals(3, user.getList(page, perpage).size());
	}

	/**
	 * 测试得到总的行数
	 *  
	 * @description
	 * 
	 * @title  testGetTotalRows
	 * @return void
	 */
	public void testGetTotalRows()
	{
		Long expect 		= 3L;
		HHUserModel user 	= new HHUserModel(new HHUserPojo());
		//Assert.assertEquals(expect, user.getTotalRows());
	}

	/**
	 * 测试用户的登陆
	 *  
	 * @description
	 * 
	 * @title  testUserLogin
	 * @return void
	 */
	@SuppressWarnings("rawtypes")
    public void testUserLogin()
	{
		HHUserPojo pojo 	= new HHUserPojo();
		pojo.setField("user_name", "test");
		pojo.setField("password", "123456");
		HHUserModel user 	= new HHUserModel(new HHUserPojo());
		Map userInfo 		= user.checkLogin(pojo);
		Assert.assertNotNull(userInfo);
	}
	
}
